<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="https://www.w3.org/1999/xhtml" lang="zh-CN" xml:lang="zh-CN">
<head><meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
    <title>6.56. Util-linux-2.12r</title>
    <link rel="stylesheet" href="../stylesheets/lfs.css" type="text/css" />
    <link rel="stylesheet" href="../stylesheets/lfs-print.css" type="text/css" media="print" />
<script> var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?d286c55b63a3c54a1e43d10d4c203e75"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); </script>
</head>
  <body id="lfs" class="6.2">
    <div class="navheader">
      <div class="headertitles">
        <h4>Linux From Scratch - 版本 6.2</h4>
        <h3>第六章 安装系统基础软件</h3>
      </div>
      <ul class="headerlinks">
        <li class="prev">
          <a accesskey="p" href="udev.html" title="Udev-096">后退</a>
          <p>Udev-096</p>
        </li>
        <li class="next">
          <a accesskey="n" href="vim.html" title="Vim-7.0">前进</a>
          <p>Vim-7.0</p>
        </li>
        <li class="up"><a accesskey="u" href="chapter06.html" title="第六章 安装系统基础软件">上一级</a></li>
        <li class="home"><a accesskey="h" href="../index.html" title="Linux From Scratch - 版本 6.2">首页</a></li>
      </ul>
    </div>
    <div class="wrap">
      <div class="titlepage">
        <h1 class="sect1">6.56. Util-linux-2.12r</h1>
      </div>
      <div class="package">
        <p>Util-linux 软件包包含许多工具。其中比较重要的是加载、卸载、格式化、分区和管理硬盘驱动器，打开 tty 端口和得到内核消息。</p>
        <div class="segmentedlist">
          <div class="seglistitem">
            <div class="seg">
              <strong><span class="segtitle">预计编译时间：</span></strong> <span class="seg">0.2 SBU</span>
            </div>
            <div class="seg">
              <strong><span class="segtitle">所需磁盘空间：</span></strong> <span class="seg">17.2 MB</span>
            </div>
          </div>
        </div>
      </div>
      <div class="installation">
        <div class="titlepage">
          <h2 class="sect2">6.56.1. FHS 兼容性说明</h2>
        </div>
        <p>FHS 推荐使用 <tt class="filename">/var/lib/hwclock</tt> 目录代替常用的 <tt class="filename">/etc</tt> 目录以定位 <tt class="filename">adjtime</tt> 文件。要将 <span><strong class="command">hwclock</strong></span> 编译成与 FHS 兼容的程序，运行下面的命令：</p>
        <pre class="userinput"><kbd class="command">sed -i 's@etc/adjtime@var/lib/hwclock/adjtime@g' \
    hwclock/hwclock.c
mkdir -p /var/lib/hwclock</kbd></pre>
      </div>
      <div class="installation">
        <div class="titlepage">
          <h2 class="sect2">6.56.2. 安装 Util-linux</h2>
        </div>
        <p>Util-linux 在基于新版本的 Linux-Libc-Headers 编译时会出错，下面的补丁修正了这个问题：</p>
        <pre class="userinput"><kbd class="command">patch -Np1 -i ../util-linux-2.12r-cramfs-1.patch</kbd></pre>
        <p>为编译 Util-linux 做准备：</p>
        <pre class="userinput"><kbd class="command">./configure</kbd></pre>
        <p>编译软件包：</p>
        <pre class="userinput"><kbd class="command">make HAVE_KILL=yes HAVE_SLN=yes</kbd></pre>
        <div class="variablelist">
          <p class="title">
            <b>make 参数的含义：</b></p>
          <dl>
            <dt>
              <span class="term"><em class="parameter"><tt>HAVE_KILL=yes</tt></em></span>
            </dt>
            <dd>
               <p>防止编译和安装 <span><strong class="command">kill</strong></span> 程序(已经由 Procps 安装了)。</p>
            </dd>
            <dt>
              <span class="term"><em class="parameter"><tt>HAVE_SLN=yes</tt></em></span>
            </dt>
            <dd>
              <p>防止编译 <span><strong class="command">sln</strong></span> 程序(这是静态连接的 <span><strong class="command">ln</strong></span> ，已经由 Glibc 安装了)。</p>
            </dd>
          </dl>
        </div>
        <p>这个软件包没有附带测试程序。</p>
        <p>安装软件包：</p>
        <pre class="userinput"><kbd class="command">make HAVE_KILL=yes HAVE_SLN=yes install</kbd></pre>
      </div>
      <div class="content">
        <div class="titlepage">
          <a id="contents-utillinux" name="contents-utillinux"></a>
          <h2 class="sect2">6.56.3. Util-linux 的内容</h2>
        </div>
        <div class="segmentedlist">
          <div class="seglistitem">
            <div class="seg">
              <strong><span class="segtitle">安装的程序：</span></strong> <span class="seg">agetty, arch,
              blockdev, cal, cfdisk, chkdupexe, col, colcrt, colrm, column,
              ctrlaltdel, cytune, ddate, dmesg, elvtune, fdformat, fdisk,
              flock, fsck.cramfs, fsck.minix, getopt, hexdump, hwclock,
              ipcrm, ipcs, isosize, line, logger, look, losetup, mcookie,
              mkfs, mkfs.bfs, mkfs.cramfs, mkfs.minix, mkswap, more, mount,
              namei, pg, pivot_root, ramsize(→rdev), raw, rdev,
              readprofile, rename, renice, rev, rootflags(→rdev),
              script, setfdprm, setsid, setterm, sfdisk, swapoff(→swapon), swapon, tailf, tunelp, ul, umount, vidmode(→rdev), whereis, write</span>
            </div>
          </div>
        </div>
        <div class="variablelist">
          <h3><a id="id3696597" name="id3696597"></a>简要描述</h3>
          <table border="0">
            <col align="left" valign="top" />
            <tbody>
              <tr>
                <td><a id="agetty" name="agetty"></a><span class="term"><span><strong class="command">agetty</strong></span></span></td>
                <td><p>打开 tty 端口，为登录名称建立命令控制符，并引出 <span><strong class="command">login</strong></span> 程序</p></td>
              </tr>
              <tr>
                <td><a id="arch" name="arch"></a><span class="term"><span><strong class="command">arch</strong></span></span></td>
                <td><p>报告机器的体系结构</p></td>
              </tr>
              <tr>
                <td><a id="blockdev" name="blockdev"></a><span class="term"><span><strong class="command">blockdev</strong></span></span></td>
                <td><p>在命令行中调用块设备的 ioctl</p></td>
              </tr>
              <tr>
                <td><a id="cal" name="cal"></a><span class="term"><span><strong class="command">cal</strong></span></span></td>
                <td><p>显示一个简单的日历</p></td>
              </tr>
              <tr>
                <td><a id="cfdisk" name="cfdisk"></a><span class="term"><span><strong class="command">cfdisk</strong></span></span></td>
                <td><p>处理指定设备的分区表</p></td>
              </tr>
              <tr>
                <td><a id="chkdupexe" name="chkdupexe"></a><span class="term"><span><strong class="command">chkdupexe</strong></span></span></td>
                <td><p>找出重复的可执行文件</p></td>
              </tr>
              <tr>
                <td><a id="col" name="col"></a><span class="term"><span><strong class="command">col</strong></span></span></td>
                <td><p>过滤回显反馈线</p></td>
              </tr>
              <tr>
                <td><a id="colcrt" name="colcrt"></a><span class="term"><span><strong class="command">colcrt</strong></span></span></td>
                <td><p>过滤那些 <span><strong class="command">nroff</strong></span> 终端不具备输出的能力，比如高分点距、半线距</p></td>
              </tr>
              <tr>
                <td><a id="colrm" name="colrm"></a><span class="term"><span><strong class="command">colrm</strong></span></span></td>
                <td><p>过滤掉给出的列</p></td>
              </tr>
              <tr>
                <td><a id="column" name="column"></a><span class="term"><span><strong class="command">column</strong></span></span></td>
                <td><p>把输出格式化为几列</p></td>
              </tr>
              <tr>
                <td><a id="ctrlaltdel" name="ctrlaltdel"></a><span class="term"><span><strong class="command">ctrlaltdel</strong></span></span></td>
                <td><p>设置 CTRL+ALT+DEL 组合键的功能为硬重启或软重启</p></td>
              </tr>
              <tr>
                <td><a id="cytune" name="cytune"></a><span class="term"><span><strong class="command">cytune</strong></span></span></td>
                <td><p>查询和修改 Cyclade 驱动器的中断入口</p></td>
              </tr>
              <tr>
                <td><a id="ddate" name="ddate"></a><span class="term"><span><strong class="command">ddate</strong></span></span></td>
                <td><p>把阳历日期转换为 Discordian 日期</p></td>
              </tr>
              <tr>
                <td><a id="dmesg" name="dmesg"></a><span class="term"><span><strong class="command">dmesg</strong></span></span></td>
                <td><p>显示内核的启动信息</p></td>
              </tr>
              <tr>
                <td><a id="elvtune" name="elvtune"></a><span class="term"><span><strong class="command">elvtune</strong></span></span></td>
                <td><p>调整块设备的相互作用和性能</p></td>
              </tr>
              <tr>
                <td><a id="fdformat" name="fdformat"></a><span class="term"><span><strong class="command">fdformat</strong></span></span></td>
                <td><p>低级格式化一张软盘</p></td>
              </tr>
              <tr>
                <td><a id="fdisk" name="fdisk"></a><span class="term"><span><strong class="command">fdisk</strong></span></span></td>
                <td><p>磁盘分区管理程序</p></td>
              </tr>
              <tr>
                <td><a id="flock" name="flock"></a><span class="term"><span><strong class="command">flock</strong></span></span></td>
                <td><p>得到一个文件锁，并根据状态执行一个命令</p></td>
              </tr>

              <tr>
                <td><a id="fsck.cramfs" name="fsck.cramfs"></a><span class="term"><span><strong class="command">fsck.cramfs</strong></span></span></td>
                <td><p>对 Cramfs 文件系统的一致性进行检查</p></td>
              </tr>
              <tr>
                <td><a id="fsck.minix" name="fsck.minix"></a><span class="term"><span><strong class="command">fsck.minix</strong></span></span></td>
                <td><p>对 Minix 文件系统的一致性进行检查</p></td>
              </tr>
              <tr>
                <td><a id="getopt" name="getopt"></a><span class="term"><span><strong class="command">getopt</strong></span></span></td>
                <td><p>在给出的命令行进行选项和参数解析</p></td>
              </tr>
              <tr>
                <td><a id="hexdump" name="hexdump"></a><span class="term"><span><strong class="command">hexdump</strong></span></span></td>
                <td><p>用用户指定的方式(包括ASCII, 十进制, 十六进制, 八进制)显示一个文件或者标准输入的数据</p></td>
              </tr>
              <tr>
                <td><a id="hwclock" name="hwclock"></a><span class="term"><span><strong class="command">hwclock</strong></span></span></td>
                <td><p>查询和设置硬件时钟(也被称为 RTC 或 BIOS 时钟)</p></td>
              </tr>
              <tr>
                <td><a id="ipcrm" name="ipcrm"></a><span class="term"><span><strong class="command">ipcrm</strong></span></span></td>
                <td><p>删除给定的进程间通信(IPC)资源</p></td>
              </tr>
              <tr>
                <td><a id="ipcs" name="ipcs"></a><span class="term"><span><strong class="command">ipcs</strong></span></span></td>
                <td><p>提供 IPC 状态信息</p></td>
              </tr>
              <tr>
                <td><a id="isosize" name="isosize"></a><span class="term"><span><strong class="command">isosize</strong></span></span></td>
                <td><p>报告 iso9660 文件系统的大小</p></td>
              </tr>
              <tr>
                <td><a id="line" name="line"></a><span class="term"><span><strong class="command">line</strong></span></span></td>
                <td><p>单行拷贝</p></td>
              </tr>
              <tr>
                <td><a id="logger" name="logger"></a><span class="term"><span><strong class="command">logger</strong></span></span></td>
                <td><p>设置系统日志的入口</p></td>
              </tr>
              <tr>
                <td><a id="look" name="look"></a><span class="term"><span><strong class="command">look</strong></span></span></td>
                <td><p>显示以某个给定字符串开头的行</p></td>
              </tr>
              <tr>
                <td><a id="losetup" name="losetup"></a><span class="term"><span><strong class="command">losetup</strong></span></span></td>
                <td><p>启动和控制回环(loop)设备</p></td>
              </tr>
              <tr>
                <td><a id="mcookie" name="mcookie"></a><span class="term"><span><strong class="command">mcookie</strong></span></span></td>
                <td><p>为 <span><strong class="command">xauth</strong></span> 生成 magic cookies (128位的随机16进制数)</p></td>
              </tr>
              <tr>
                <td><a id="mkfs" name="mkfs"></a><span class="term"><span><strong class="command">mkfs</strong></span></span></td>
                <td><p>在一个设备(通常是一个硬盘分区)设备上建立文件系统</p></td>
              </tr>
              <tr>
                <td><a id="mkfs.bfs" name="mkfs.bfs"></a><span class="term"><span><strong class="command">mkfs.bfs</strong></span></span></td>
                <td><p>创建一个 Santa Cruz Operations (SCO) bfs 文件系统</p></td>
              </tr>
              <tr>
                <td><a id="mkfs.cramfs" name="mkfs.cramfs"></a><span class="term"><span><strong class="command">mkfs.cramfs</strong></span></span></td>
                <td><p>创建 cramfs 文件系统</p></td>
              </tr>
              <tr>
                <td><a id="mkfs.minix" name="mkfs.minix"></a><span class="term"><span><strong class="command">mkfs.minix</strong></span></span></td>
                <td><p>创建 Minix 文件系统</p></td>
              </tr>
              <tr>
                <td><a id="mkswap" name="mkswap"></a><span class="term"><span><strong class="command">mkswap</strong></span></span></td>
                <td><p>初始化指定设备或文件，以用做交换分区</p></td>
              </tr>
              <tr>
                <td><a id="more" name="more"></a><span class="term"><span><strong class="command">more</strong></span></span></td>
                <td><p>分屏显示文件，但没有 less 好用</p></td>
              </tr>
              <tr>
                <td><a id="mount" name="mount"></a><span class="term"><span><strong class="command">mount</strong></span></span></td>
                <td><p>把一个文件系统从一个设备挂载到一个目录</p></td>
              </tr>
              <tr>
                <td><a id="namei" name="namei"></a><span class="term"><span><strong class="command">namei</strong></span></span></td>
                <td><p>显示指定路径的符号链接</p></td>
              </tr>
              <tr>
                <td><a id="pg" name="pg"></a><span class="term"><span><strong class="command">pg</strong></span></span></td>
                <td><p>显示文本文件内容，一次显示一屏</p></td>
              </tr>
              <tr>
                <td><a id="pivot_root" name="pivot_root"></a><span class="term"><span><strong class="command">pivot_root</strong></span></span></td>
                <td><p>使某个文件系统成为当前进程的根文件系统</p></td>
              </tr>

              <tr>
                <td><a id="ramsize" name="ramsize"></a><span class="term"><span><strong class="command">ramsize</strong></span></span></td>
                <td><p>显示或者改变 RAM disk 的大小</p></td>
              </tr>
              <tr>
                <td><a id="raw" name="raw"></a><span class="term"><span><strong class="command">raw</strong></span></span></td>
                <td><p>将一个原始的 Linux 字符设备绑定到一个块设备</p></td>
              </tr>
              <tr>
                <td><a id="rdev" name="rdev"></a><span class="term"><span><strong class="command">rdev</strong></span></span></td>
                <td><p>查询和设置内核的根设备和其他信息</p></td>
              </tr>
              <tr>
                <td><a id="readprofile" name="readprofile"></a><span class="term"><span><strong class="command">readprofile</strong></span></span></td>
                <td><p>显示内核侧写文件 /proc/profile 的信息</p></td>
              </tr>
              <tr>
                <td><a id="rename" name="rename"></a><span class="term"><span><strong class="command">rename</strong></span></span></td>
                <td><p>对文件进行重命名</p></td>
              </tr>
              <tr>
                <td><a id="renice" name="renice"></a><span class="term"><span><strong class="command">renice</strong></span></span></td>
                <td><p>修改正在运行进程的优先级</p></td>
              </tr>
              <tr>
                <td><a id="rev" name="rev"></a><span class="term"><span><strong class="command">rev</strong></span></span></td>
                <td><p>颠倒一个文件每行字符的顺序</p></td>
              </tr>
              <tr>
                <td><a id="rootflags" name="rootflags"></a><span class="term"><span><strong class="command">rootflags</strong></span></span></td>
                <td><p>在挂载根设备时查询和设置额外的信息</p></td>
              </tr>
              <tr>
                <td><a id="script" name="script"></a><span class="term"><span><strong class="command">script</strong></span></span></td>
                <td><p>为终端会话过程建立一个 typescipt 文件，记录会话过程中终端的输出。</p></td>
              </tr>
              <tr>
                <td><a id="setfdprm" name="setfdprm"></a><span class="term"><span><strong class="command">setfdprm</strong></span></span></td>
                <td><p>设置用户定义的软盘参数</p></td>
              </tr>
              <tr>
                <td><a id="setsid" name="setsid"></a><span class="term"><span><strong class="command">setsid</strong></span></span></td>
                <td><p>在一个新的会话中运行程序</p></td>
              </tr>
              <tr>
                <td><a id="setterm" name="setterm"></a><span class="term"><span><strong class="command">setterm</strong></span></span></td>
                <td><p>设置终端属性</p></td>
              </tr>
              <tr>
                <td><a id="sfdisk" name="sfdisk"></a><span class="term"><span><strong class="command">sfdisk</strong></span></span></td>
                <td><p>磁盘分区表管理工具</p></td>
              </tr>

              <tr>
                <td><a id="swapoff" name="swapoff"></a><span class="term"><span><strong class="command">swapoff</strong></span></span></td>
                <td><p>取消对指定交换设备和交换文件的使用</p></td>
              </tr>
              <tr>
                <td><a id="swapon" name="swapon"></a><span class="term"><span><strong class="command">swapon</strong></span></span></td>
                <td><p>使指定的交换设备和交换文件生效</p></td>
              </tr>
              <tr>
                <td><a id="tailf" name="tailf"></a><span class="term"><span><strong class="command">tailf</strong></span></span></td>
                <td><p>跟踪一个日志文件，显示日志的最后10行，并将日志中新的记录也显示出来。</p></td>
              </tr>
              <tr>
                <td><a id="tunelp" name="tunelp"></a><span class="term"><span><strong class="command">tunelp</strong></span></span></td>
                <td><p>设置打印设备的参数</p></td>
              </tr>
              <tr>
                <td><a id="ul" name="ul"></a><span class="term"><span><strong class="command">ul</strong></span></span></td>
                <td><p>用来将指定文件中出现的下划线使用指定终端画下横线的序列</p></td>
              </tr>
              <tr>
                <td><a id="umount" name="umount"></a><span class="term"><span><strong class="command">umount</strong></span></span></td>
                <td><p>卸载一个被挂载的文件系统</p></td>
              </tr>
              <tr>
                <td><a id="vidmode" name="vidmode"></a><span class="term"><span><strong class="command">vidmode</strong></span></span></td>
                <td><p>查询和设置视频模式</p></td>
              </tr>
              <tr>
                <td><a id="whereis" name="whereis"></a><span class="term"><span><strong class="command">whereis</strong></span></span></td>
                <td><p>确定某命令二进制文件、源文件、手册文档的位置</p></td>
              </tr>
              <tr>
                <td><a id="write" name="write"></a><span class="term"><span><strong class="command">write</strong></span></span></td>
                <td><p>发一个消息给另一个用户，<span class="emphasis"><em>如果</em></span>他开启了 writting 的话。</p></td>
              </tr>
            </tbody>
          </table>
        </div>
      </div>
    </div>
    <div class="navfooter">
      <ul>
        <li class="prev">
          <a accesskey="p" href="udev.html" title="Udev-096">后退</a>
          <p>Udev-096</p>
        </li>
        <li class="next">
          <a accesskey="n" href="vim.html" title="Vim-7.0">前进</a>
          <p>Vim-7.0</p>
        </li>
        <li class="up"><a accesskey="u" href="chapter06.html" title="第六章 安装系统基础软件">上一级</a></li>
        <li class="home"><a accesskey="h" href="../index.html" title="Linux From Scratch - 版本 6.2">首页</a>.
        </li>
      </ul>
    </div>
</body></html>
